home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Kit PC World De Ampliacion De Windows 95
/
Kit PC World de ampliacion de Windows 95.iso
/
clarion
/
cw15
/
examp15.z
/
TREE.TXT
< prev
next >
Wrap
Text File
|
1995-09-07
|
6KB
|
140 lines
The TREE Application
TREE is a simple application that illustrates the productivity,
power, and performance available with Clarion for Windows V1.5:
High Productivity
An application like TREE can easily be developed in 2 days or less
with CW1.5. The data dictionary for TREE (Orders.dct) was created
using the data dictionary editor, however, these file layouts
could have been imported directly from existing data files.
The core of the application, which consists of the MDI frame and
menu structure along with the file browse and update dialogs, was
automatically produced by the Application Wizard. The customer
order tree dialog was produced by the RelationTree template. The
reports were all produced by the Report template.
Fewer than 12 lines of embedded source code were needed to
supplement the behavior generated by the standard templates. The
test time required to validate TREE was minimal because nearly
100% of its source code was contributed by reusable pre-tested
templates.
Relation Tree
TREE is named for the Customer/Order/Item expandable tree control
invoked from the Browse menu. Each element of the tree displays
the description of a customer, Order, or Item record. The
different levels are distinguished by unique icons and display
colors. In addition, each level can be associated with a different
dialog box in order to insert, change, or delete records. These
requests can be made using command buttons or by clicking the
right mouse button. The only embedded source code (the code you
write) necessary to produce this complex behavior creates an item
description by looking up a record in the Product file.
Automatic Primary Keys
Customer numbers, order numbers, and item numbers are automati-
cally generated by the TREE application. Accordingly, they cannot
be modified and never appear in an entry control. (They are
displayed as strings.) This behavior is specified in the data
dictionary is generated automatically by the templates.
The primary key for the customer file contains only the customer
number. The primary key for the order file contains a customer
number and an order number. Orders for each customer start with
order number 1. Similarly, the primary key for the item file
contains a customer number, order number, and (line) item number.
Item numbers start with 1 for each order.
Referential Integrity
If you try to delete a record for a customer with pending orders,
you will be prevented from doing so. This is called a
Delete/Restrict referential integrity constraint. Likewise, if
you delete an order, all of its items will also be deleted. This
is called a Delete/Cascade restraint. Nor can a product be
deleted if it has pending items (Delete/Restrict). There is no
need for Update constraints because the relevant primary keys
cannot be changed.
The behavior that produces these referential integrity constraints
is automatically produced by the templates as a result of data
dictionary settings. At any time in the future, RI behavior can
be changed by simply modifying the data dictionary and regenerat-
ing the application.
Database Portability
TREE uses the TopSpeed database engine, a proprietary technology
that uses minimal resources (50K DLL or library) and produces a
very small footprint (by dynamically compressing data). The
TopSpeed engine is also surprisingly fast. However, this
application can be retargeted to use Clarion, dBase, FoxPro,
Clipper, Btrieve, ODBC, Oracle, or AS/400 files by simply
changing data dictionary settings and regenerating. (Oracle and
AS/400 drivers are available at additional cost. SQL Server
and Sybase drivers will be available soon.)
Multi-threaded MDI
TREE uses a multi-threaded, multi-document interface (MDI). Each
browse window and report starts on a different thread. As a
result, all three browse windows can be open while reports are
printing. CW1.5 uses its own internal thread management under
Windows 3.1x. 32 bit applications use standard Windows 95 or
Windows NT threads.
Integrated Print Engine
TREE prints 3 reports: a customer invoice, a mailing list, and a
price list. The invoice and price list use color graphics. The
invoice report contains embedded source that calls a browse dialog
to identify the invoice requested. The Report template automati-
cally produces the necessary behavior to preview reports before
they are printed.
Importantly, these reports are contained within the application
itself--an external report writer is not required. Like TREE,
many "real world" applications can benefit from the high degree
of interaction and programmability offered by an integrated print
engine. Such integration offers design time, run-time, and life-
time efficiencies because all visual elements (windows and
reports) use the same development environment, data dictionary,
and database drivers.
16/32 Bit Word Length
Under the control of a setting in the project system, CW1.5 will
produce either 16 bit or 32 bit versions of TREE. All CW
applications are word-size neutral unless they specifically call
Windows functions that are not supported by all versions. The
Windows 95 controls such as property sheets (tabbed notebooks) and
tool tips (help balloons) have been cloned for use with Windows
3.1x. In the same vein, 16 bit VBX support has been cloned for use
with Windows 95 and Windows NT.
One-Piece Executable
TREE complies into a 780K one piece 16 bit or a 723K 32 bit
executable. This single executable comprises the entire "ship
list" for the TREE application. If you are shipping more than one
CW application, you should consider shipping the CW library as a
stand-alone DLL. When linked with the stand-alone run-time
library, the TREE executable takes only 224K (243K for 32 bit).
The "ship list" includes CWRUNxx.DLL (the run-time library) at
644K (512K for 32 bit) and CWTSPxx.DLL (the TopSpeed database
driver) at 50K (42K for 32 bit).